package com.example.demo.dao;

import com.example.demo.domain.*;
import com.example.demo.support.CustomRepository;
import org.hibernate.annotations.SQLInsert;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;

import java.util.List;

@RepositoryRestResource(path = "user")
public interface UserRepository extends CustomRepository<User,Long> {
    User findByName(String name);

    @Query("select u from User u where u.name= :name")


    @RestResource(path = "nameStartsWith", rel = "nameStartsWith")
    User findByNameStartsWith(@Param("name") String name);

    List<User> findById(long id);


}
